package com.servlet.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DBUtil {
	private static final String URL="jdbc:mysql://localhost:3306/servlet1";
	private static final String USER="root";
	private static final String PASSWORD="1234";
	private static Connection conn=null;
	static{
		try {
			//加载驱动
			Class.forName("com.mysql.jdbc.Driver");
			//创建连接
			 conn=DriverManager.getConnection(URL, USER, PASSWORD);
		} catch (ClassNotFoundException e) {
			
			e.printStackTrace();
		} catch (SQLException e) {
			
			e.printStackTrace();
		}
	}
	public static Connection getConnection(){

		return conn;
	}
	public void close(){
		
	}
}
